const deleteInput=document.getElementById("deleteInput")
const deleteBtn=document.getElementById("deleteBtn");
deleteBtn.addEventListener("click",async ()=>{
    await requestDelete()
})

async function requestDelete(){
    const deleteName=deleteInput.value;
    const url=`${config.server}`+"/api/admin/delete/card/by/name"
    const data={
        "token":token,
        "card_name":deleteName
    }
    const response=await fetch(url,{
        method:"POST",
        headers: { 'Content-Type': 'application/json' },
        body:JSON.stringify(data)
    })
    const getdata=await response.json()
    if(response.ok){
        alert("删除成功")
        location.reload()
    }else{
        console.log("获取数据失败",getdata)
        alert("删除失败，很可能是填入了错误的名字")
    }
}